<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
	<title>WeUI</title>
	<link rel="stylesheet" href="../css/weui.css"/>

	<link rel="stylesheet" href="../css/jquery-weui.css">
	<link rel="stylesheet" href="../css/demos.css">

	<script src="../js/jquery-2.1.1.min.js"></script>
	<script src="../js/jquery-weui.js"></script>
	<script src="../layer/layer.js"></script>
	<script src="../js/main.js"></script>
	<title>搜索</title>
</head>

<body >

<div id="d" style="padding-bottom:10%;width:100%;height:0;margin-top: 1rem;background-color: black;margin-top: 0px;">
	<div style="width:70%;margin:auto auto;">
		<img src="../img/index/top.png" style="height: auto;width:100%; margin:auto auto;"/>
	</div>
</div>


<div class="weui-search-bar" id="searchBar">

	<form class="weui-search-bar__form">
		<div class="weui-search-bar__box">
			<i class="weui-icon-search"></i>
			<input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" required="">
			<a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
		</div>
		<label class="weui-search-bar__label" id="searchText">
			<i class="weui-icon-search"></i>
			<span>搜索</span>
		</label>
	</form>
	<a href="javascript:" class="weui-search-bar__cancel-btn" onclick="findUser()" id="searchCancel1">确定</a>
	<a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel2">取消</a>
</div>


<div class="weui-panel weui-panel_access">
	<div class="weui-panel__hd">搜索结果</div>

	<div class="weui-panel__bd" id="data">
		<!--<a href="Expert/contact.html" class="weui-media-box weui-media-box_appmsg">-->
		<!--<div class="weui-media-box__hd" style="border: 1px solid black;">-->
		<!--<img class=" weui-media-box__thumb" src="">-->
		<!--</div>-->
		<!--<div class="weui-media-box__bd">-->
		<!--<h4 class="weui-media-box__title">专家a</h4>-->
		<!--<p class="weui-media-box__desc">专家a介绍 专家a介绍 专家a介绍</p>-->
		<!--</div>-->
		<!--</a>-->
	</div>
	<div class="weui-btn weui-btn_loading" style="color: darkslategray" id="load" onclick="loadData()">
		加载更多
	</div>
</div>
<script>
    $.ajaxSetup({
        xhrFields: {
            withCredentials: isCrossDomain
        }
    });
    var page = 1;
    var infos = "";
    var isNext = true;
    function loadData() {
        if(isNext) {
            $.post(mainurl+"skill/getDemands",{page:page,info:infos},function (data) {
                if(checkData(data)){
                    isNext = data.data.hasNextPage;
                    if(!isNext){
                        $("#load").text("");
                    }
                    page++;
                    for(var i=0; i<data.data.list.length; i++) {
                        var d = data.data.list[i];
                        var id = d.did;
                        var info = d.detail;
                        $("#data").append("<a href=\"demreleaseInfo.html?id="+id+"\" class=\"weui-media-box weui-media-box_appmsg\">\n" +
                            "            <div class=\"weui-media-box__bd\">\n" +
                            "                <h4 class=\"weui-media-box__title\">需求编号："+id+"</h4>\n" +
                            "                <p class=\"weui-media-box__desc\">"+info+"</p>\n" +
                            "            </div>\n" +
                            "        </a>");
                    }
                }
            });
        }

    }
    function findUser() {
        infos = $("#searchInput").val();
        isNext = true;
        page=1;
        $("#data a").remove();
        loadData();
    }
    $(function () {
        loadData();
    })
</script>

</body>

</html>